<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>项目bug汇总 | ShuangChenYue</title>
    <meta name="generator" content="VuePress 1.9.9">
    <link rel="icon" href="https://cdn.jsdelivr.net/gh/cmty256/imgs-blog@main/logo/白云.38zbldnhh180.jpg">
    <meta name="description" content="满招损，谦受益">
    <meta name="keywords" content="专注于Cpp语言的旅行者">
    
    <link rel="preload" href="/assets/css/0.styles.3fffbd7d.css" as="style"><link rel="preload" href="/assets/js/app.ef25b098.js" as="script"><link rel="preload" href="/assets/js/2.4615a819.js" as="script"><link rel="preload" href="/assets/js/86.b6a21db1.js" as="script"><link rel="prefetch" href="/assets/js/10.5712a6b9.js"><link rel="prefetch" href="/assets/js/11.1fed716c.js"><link rel="prefetch" href="/assets/js/12.4672093d.js"><link rel="prefetch" href="/assets/js/13.cda96393.js"><link rel="prefetch" href="/assets/js/14.0924c9b3.js"><link rel="prefetch" href="/assets/js/15.443e1f82.js"><link rel="prefetch" href="/assets/js/16.554bf912.js"><link rel="prefetch" href="/assets/js/17.994ca8e7.js"><link rel="prefetch" href="/assets/js/18.4879414d.js"><link rel="prefetch" href="/assets/js/19.f66c5ece.js"><link rel="prefetch" href="/assets/js/20.79449f9c.js"><link rel="prefetch" href="/assets/js/21.0b51ee17.js"><link rel="prefetch" href="/assets/js/22.14f9241e.js"><link rel="prefetch" href="/assets/js/23.fa858e5d.js"><link rel="prefetch" href="/assets/js/24.a420d3d2.js"><link rel="prefetch" href="/assets/js/25.fee08d36.js"><link rel="prefetch" href="/assets/js/26.92805480.js"><link rel="prefetch" href="/assets/js/27.5c60f91f.js"><link rel="prefetch" href="/assets/js/28.2bbf1597.js"><link rel="prefetch" href="/assets/js/29.05fbd423.js"><link rel="prefetch" href="/assets/js/3.7b56aee3.js"><link rel="prefetch" href="/assets/js/30.54f725db.js"><link rel="prefetch" href="/assets/js/31.3e5c530d.js"><link rel="prefetch" href="/assets/js/32.f8ecda14.js"><link rel="prefetch" href="/assets/js/33.3bef3da7.js"><link rel="prefetch" href="/assets/js/34.0e1b1990.js"><link rel="prefetch" href="/assets/js/35.21acae61.js"><link rel="prefetch" href="/assets/js/36.744eb2f7.js"><link rel="prefetch" href="/assets/js/37.077678f2.js"><link rel="prefetch" href="/assets/js/38.d2c19552.js"><link rel="prefetch" href="/assets/js/39.d873f04b.js"><link rel="prefetch" href="/assets/js/4.8844c7c6.js"><link rel="prefetch" href="/assets/js/40.a9c0394e.js"><link rel="prefetch" href="/assets/js/41.bd1b72f7.js"><link rel="prefetch" href="/assets/js/42.8c5ba50f.js"><link rel="prefetch" href="/assets/js/43.aac76280.js"><link rel="prefetch" href="/assets/js/44.2601ff73.js"><link rel="prefetch" href="/assets/js/45.2802dd41.js"><link rel="prefetch" href="/assets/js/46.3a872e80.js"><link rel="prefetch" href="/assets/js/47.fb914cfa.js"><link rel="prefetch" href="/assets/js/48.4ce4214b.js"><link rel="prefetch" href="/assets/js/49.968e0b60.js"><link rel="prefetch" href="/assets/js/5.d85ca603.js"><link rel="prefetch" href="/assets/js/50.4cee1e39.js"><link rel="prefetch" href="/assets/js/51.5cad3040.js"><link rel="prefetch" href="/assets/js/52.1612ad39.js"><link rel="prefetch" href="/assets/js/53.e9cf7aec.js"><link rel="prefetch" href="/assets/js/54.2821cc0e.js"><link rel="prefetch" href="/assets/js/55.6f8ddb85.js"><link rel="prefetch" href="/assets/js/56.58b793ba.js"><link rel="prefetch" href="/assets/js/57.3d08056f.js"><link rel="prefetch" href="/assets/js/58.880ee89f.js"><link rel="prefetch" href="/assets/js/59.987dab20.js"><link rel="prefetch" href="/assets/js/6.b5c87a76.js"><link rel="prefetch" href="/assets/js/60.6089e8d9.js"><link rel="prefetch" href="/assets/js/61.2f20e8a2.js"><link rel="prefetch" href="/assets/js/62.03592460.js"><link rel="prefetch" href="/assets/js/63.77002dd4.js"><link rel="prefetch" href="/assets/js/64.180619d0.js"><link rel="prefetch" href="/assets/js/65.2750f9b6.js"><link rel="prefetch" href="/assets/js/66.c696b1af.js"><link rel="prefetch" href="/assets/js/67.03363cd9.js"><link rel="prefetch" href="/assets/js/68.163161cc.js"><link rel="prefetch" href="/assets/js/69.6d87bcc0.js"><link rel="prefetch" href="/assets/js/7.70b0614b.js"><link rel="prefetch" href="/assets/js/70.53173d63.js"><link rel="prefetch" href="/assets/js/71.5acaf78b.js"><link rel="prefetch" href="/assets/js/72.e5473318.js"><link rel="prefetch" href="/assets/js/73.fca88a39.js"><link rel="prefetch" href="/assets/js/74.d45cfae5.js"><link rel="prefetch" href="/assets/js/75.81660c22.js"><link rel="prefetch" href="/assets/js/76.3e7aeba1.js"><link rel="prefetch" href="/assets/js/77.2e4da6e0.js"><link rel="prefetch" href="/assets/js/78.7f7d7694.js"><link rel="prefetch" href="/assets/js/79.f60ae352.js"><link rel="prefetch" href="/assets/js/8.ecc019cf.js"><link rel="prefetch" href="/assets/js/80.3a10fa1d.js"><link rel="prefetch" href="/assets/js/81.72805d9a.js"><link rel="prefetch" href="/assets/js/82.c1d3f9b6.js"><link rel="prefetch" href="/assets/js/83.9014695a.js"><link rel="prefetch" href="/assets/js/84.4602494c.js"><link rel="prefetch" href="/assets/js/85.f2189c96.js"><link rel="prefetch" href="/assets/js/87.9be7c553.js"><link rel="prefetch" href="/assets/js/88.562483e1.js"><link rel="prefetch" href="/assets/js/89.336befe6.js"><link rel="prefetch" href="/assets/js/9.4b46b767.js"><link rel="prefetch" href="/assets/js/90.e916d603.js"><link rel="prefetch" href="/assets/js/91.873db624.js"><link rel="prefetch" href="/assets/js/92.9072026b.js"><link rel="prefetch" href="/assets/js/93.0baf9593.js"><link rel="prefetch" href="/assets/js/94.8655b40d.js"><link rel="prefetch" href="/assets/js/95.bd6a4d6c.js"><link rel="prefetch" href="/assets/js/96.943e9bb3.js"><link rel="prefetch" href="/assets/js/97.ea0c9e4a.js">
    <link rel="stylesheet" href="/assets/css/0.styles.3fffbd7d.css">
  </head>
  <body class="theme-mode-light">
    <div id="app" data-server-rendered="true"><div class="theme-container sidebar-open"><header class="navbar blur"><div title="目录" class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="https://cdn.jsdelivr.net/gh/cmty256/imgs-blog@main/logo/白云.38zbldnhh180.jpg" alt="ShuangChenYue" class="logo"> <span class="site-name can-hide">ShuangChenYue</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link">首页</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="CPP语言" class="dropdown-title"><!----> <span class="title" style="display:;">CPP语言</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/c5bdd8/" class="nav-link">Cpp之旅</a></li><li class="dropdown-item"><!----> <a href="/pages/279e62/" class="nav-link">Cpp专栏</a></li><li class="dropdown-item"><!----> <a href="/pages/801755/" class="nav-link">Effective_CPP</a></li><li class="dropdown-item"><!----> <a href="/pages/6b2468/" class="nav-link">muduo网络库</a></li><li class="dropdown-item"><!----> <a href="/pages/5f8c9f/" class="nav-link">Unix环境高级编程</a></li><li class="dropdown-item"><!----> <a href="/pages/3f1d21/" class="nav-link">Cpp提高编程</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="计算机基础" class="dropdown-title"><!----> <span class="title" style="display:;">计算机基础</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/7b1cb2/" class="nav-link">计算机网络</a></li><li class="dropdown-item"><!----> <a href="/pages/6048a8/" class="nav-link">操作系统</a></li><li class="dropdown-item"><!----> <a href="/pages/3b34ba/" class="nav-link">数据结构</a></li><li class="dropdown-item"><!----> <a href="/pages/412fe7/" class="nav-link">Linux</a></li><li class="dropdown-item"><!----> <a href="/pages/2dcfa1/" class="nav-link">算法</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="数据库" class="dropdown-title"><!----> <span class="title" style="display:;">数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/efa3f2/" class="nav-link">基础篇</a></li><li class="dropdown-item"><!----> <a href="/pages/ccc445/" class="nav-link">MySql</a></li><li class="dropdown-item"><!----> <a href="/pages/54616e/" class="nav-link">Redis</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="系统设计" class="dropdown-title"><!----> <span class="title" style="display:;">系统设计</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/793d0a/" class="nav-link">权限校验</a></li><li class="dropdown-item"><!----> <a href="/pages/73ddd7/" class="nav-link">设计模式</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="开发日常" class="dropdown-title"><!----> <span class="title" style="display:;">开发日常</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/71f6ae/" class="nav-link">Git知识总结</a></li><li class="dropdown-item"><!----> <a href="/pages/777b8a/" class="nav-link">nvm使用小结</a></li><li class="dropdown-item"><!----> <a href="/pages/ee770e/" class="nav-link">虚拟机固定 IP 地址</a></li><li class="dropdown-item"><!----> <a href="/pages/e472d1/" class="nav-link">随笔（持续更新）</a></li><li class="dropdown-item"><!----> <a href="/pages/411aa4/" class="nav-link">VScode 插件 CodeGeeX 使用教程</a></li><li class="dropdown-item"><!----> <a href="/pages/0d525d/" class="nav-link">KylinV10 将项目上传至 Github教程</a></li><li class="dropdown-item"><!----> <a href="/pages/ef40f0/" class="nav-link">KylinV10 安装 MySQL 教程（可防踩雷）</a></li><li class="dropdown-item"><!----> <a href="/pages/f8640c/" class="nav-link">个人博客代码推送教程</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="前端学习" class="dropdown-title"><!----> <span class="title" style="display:;">前端学习</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/99897f/" class="nav-link">HTML与CSS</a></li><li class="dropdown-item"><!----> <a href="/pages/51542d/" class="nav-link">JS学习</a></li><li class="dropdown-item"><!----> <a href="/pages/803f9d/" class="nav-link">Vue3入门</a></li><li class="dropdown-item"><!----> <a href="/pages/ca4cfb/" class="nav-link">Vue3进阶</a></li><li class="dropdown-item"><!----> <a href="/pages/50e8d3/" class="nav-link">黑马Vue3</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="项目笔记" class="dropdown-title"><!----> <span class="title" style="display:;">项目笔记</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/08dfe9/" class="nav-link">ip_file_hook</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="面经" class="dropdown-title"><!----> <span class="title" style="display:;">面经</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/d69946/" class="nav-link">虎牙C++技术面经</a></li><li class="dropdown-item"><!----> <a href="/pages/29251d/" class="nav-link">金山一面复习</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="其它" class="dropdown-title"><!----> <span class="title" style="display:;">其它</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/fa256e/" class="nav-link">博客搭建</a></li><li class="dropdown-item"><!----> <a href="/pages/335531/" class="nav-link">网站收藏箱</a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <div class="sidebar-hover-trigger"></div> <aside class="sidebar" style="display:none;"><!----> <nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link">首页</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="CPP语言" class="dropdown-title"><!----> <span class="title" style="display:;">CPP语言</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/c5bdd8/" class="nav-link">Cpp之旅</a></li><li class="dropdown-item"><!----> <a href="/pages/279e62/" class="nav-link">Cpp专栏</a></li><li class="dropdown-item"><!----> <a href="/pages/801755/" class="nav-link">Effective_CPP</a></li><li class="dropdown-item"><!----> <a href="/pages/6b2468/" class="nav-link">muduo网络库</a></li><li class="dropdown-item"><!----> <a href="/pages/5f8c9f/" class="nav-link">Unix环境高级编程</a></li><li class="dropdown-item"><!----> <a href="/pages/3f1d21/" class="nav-link">Cpp提高编程</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="计算机基础" class="dropdown-title"><!----> <span class="title" style="display:;">计算机基础</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/7b1cb2/" class="nav-link">计算机网络</a></li><li class="dropdown-item"><!----> <a href="/pages/6048a8/" class="nav-link">操作系统</a></li><li class="dropdown-item"><!----> <a href="/pages/3b34ba/" class="nav-link">数据结构</a></li><li class="dropdown-item"><!----> <a href="/pages/412fe7/" class="nav-link">Linux</a></li><li class="dropdown-item"><!----> <a href="/pages/2dcfa1/" class="nav-link">算法</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="数据库" class="dropdown-title"><!----> <span class="title" style="display:;">数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/efa3f2/" class="nav-link">基础篇</a></li><li class="dropdown-item"><!----> <a href="/pages/ccc445/" class="nav-link">MySql</a></li><li class="dropdown-item"><!----> <a href="/pages/54616e/" class="nav-link">Redis</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="系统设计" class="dropdown-title"><!----> <span class="title" style="display:;">系统设计</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/793d0a/" class="nav-link">权限校验</a></li><li class="dropdown-item"><!----> <a href="/pages/73ddd7/" class="nav-link">设计模式</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="开发日常" class="dropdown-title"><!----> <span class="title" style="display:;">开发日常</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/71f6ae/" class="nav-link">Git知识总结</a></li><li class="dropdown-item"><!----> <a href="/pages/777b8a/" class="nav-link">nvm使用小结</a></li><li class="dropdown-item"><!----> <a href="/pages/ee770e/" class="nav-link">虚拟机固定 IP 地址</a></li><li class="dropdown-item"><!----> <a href="/pages/e472d1/" class="nav-link">随笔（持续更新）</a></li><li class="dropdown-item"><!----> <a href="/pages/411aa4/" class="nav-link">VScode 插件 CodeGeeX 使用教程</a></li><li class="dropdown-item"><!----> <a href="/pages/0d525d/" class="nav-link">KylinV10 将项目上传至 Github教程</a></li><li class="dropdown-item"><!----> <a href="/pages/ef40f0/" class="nav-link">KylinV10 安装 MySQL 教程（可防踩雷）</a></li><li class="dropdown-item"><!----> <a href="/pages/f8640c/" class="nav-link">个人博客代码推送教程</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="前端学习" class="dropdown-title"><!----> <span class="title" style="display:;">前端学习</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/99897f/" class="nav-link">HTML与CSS</a></li><li class="dropdown-item"><!----> <a href="/pages/51542d/" class="nav-link">JS学习</a></li><li class="dropdown-item"><!----> <a href="/pages/803f9d/" class="nav-link">Vue3入门</a></li><li class="dropdown-item"><!----> <a href="/pages/ca4cfb/" class="nav-link">Vue3进阶</a></li><li class="dropdown-item"><!----> <a href="/pages/50e8d3/" class="nav-link">黑马Vue3</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="项目笔记" class="dropdown-title"><!----> <span class="title" style="display:;">项目笔记</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/08dfe9/" class="nav-link">ip_file_hook</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="面经" class="dropdown-title"><!----> <span class="title" style="display:;">面经</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/d69946/" class="nav-link">虎牙C++技术面经</a></li><li class="dropdown-item"><!----> <a href="/pages/29251d/" class="nav-link">金山一面复习</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="其它" class="dropdown-title"><!----> <span class="title" style="display:;">其它</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/fa256e/" class="nav-link">博客搭建</a></li><li class="dropdown-item"><!----> <a href="/pages/335531/" class="nav-link">网站收藏箱</a></li></ul></div></div> <!----></nav>  <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>存储介质消除工具</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>ip_file_hook</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/pages/08dfe9/" class="sidebar-link">项目解读</a></li><li><a href="/pages/00e0b6/" aria-current="page" class="active sidebar-link">项目bug汇总</a></li></ul></section></li></ul> </aside> <div><main class="page"><div class="theme-vdoing-wrapper "><div class="articleInfo-wrap" data-v-06225672><div class="articleInfo" data-v-06225672><ul class="breadcrumbs" data-v-06225672><li data-v-06225672><a href="/" title="首页" class="iconfont icon-home router-link-active" data-v-06225672></a></li> <li data-v-06225672><span data-v-06225672>项目笔记</span></li><li data-v-06225672><span data-v-06225672>ip_file_hook</span></li></ul> <div class="info" data-v-06225672><div title="作者" class="author iconfont icon-touxiang" data-v-06225672><a href="javascript:;" data-v-06225672>霜晨月</a></div> <div title="创建时间" class="date iconfont icon-riqi" data-v-06225672><a href="javascript:;" data-v-06225672>2023-11-24</a></div> <!----></div></div></div> <!----> <div class="content-wrapper"><!----> <h1><img src="">项目bug汇总<!----></h1> <!----> <div class="theme-vdoing-content content__default"><p>1、先搜索target_link_libraries然后在 cjson 后面加上dl</p> <p><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1699239042629.webp" alt="1699239042629"></p> <p><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1699238999430.webp" alt="1699238999430"></p> <p>2、记得在CMakeLists.txt文件中添加</p> <p><code>set(CMAKE_CXX_STANDARD 11)</code></p> <p><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1699239105937.webp" alt="1699239105937"></p> <p>3、Ninja下载</p> <p><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1699239253988.webp" alt="1699239253988"></p> <p>你遇到的问题与CMake项目的配置有关。CMake 无法找到与 &quot;Ninja&quot; 对应的构建程序，同时还提示C和Cpp编译器未设置。通常可以通过以下步骤解决这些问题：</p> <ol><li><p><strong>安装 Ninja</strong>：
如果你想使用 Ninja 作为构建工具，你需要确保它已安装在你的系统上。Ninja 是一种构建工具，通常比 Make 更快。你可以使用系统的软件包管理器来安装它。例如，在 Debian/Ubuntu 上，你可以运行以下命令：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>sudo apt-get install ninja-build
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>在其他系统上，你可能需要使用不同的软件包管理器或手动下载 Ninja。</p></li> <li><p><strong>设置C和Cpp编译器</strong>：
CMake 需要知道要使用哪个C和Cpp编译器。你可以在运行CMake时通过设置 <code>CMAKE_C_COMPILER</code> 和 <code>CMAKE_CXX_COMPILER</code> 变量来指定这些编译器。例如，如果你想使用GCC作为编译器，可以执行以下命令：</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code>cmake <span class="token parameter variable">-DCMAKE_C_COMPILER</span><span class="token operator">=</span>gcc <span class="token parameter variable">-DCMAKE_CXX_COMPILER</span><span class="token operator">=</span>g++ /你的源代码路径
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>请将 &quot;gcc&quot; 和 &quot;g++&quot; 替换为你的系统上适当的编译器命令。</p></li> <li><p><strong>生成构建系统</strong>：
在设置编译器和任何其他必要选项后，你可以生成构建系统。确保指定要使用的生成器（在这种情况下是Ninja）：</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code>cmake <span class="token parameter variable">--build</span> <span class="token builtin class-name">.</span> <span class="token parameter variable">-G</span> Ninja
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>将 &quot;.&quot; 替换为你的CMake项目目录的路径。这个命令将生成Ninja构建文件并启动构建过程。</p></li></ol> <p>如果你不想使用Ninja作为构建系统，你可以在命令中使用不同的生成器，常见的替代选项包括 &quot;Make&quot; 或不指定生成器（CMake将使用系统的默认生成器）。</p> <p>一旦你解决了这些问题，CMake应该能够成功配置你的项目并生成构建系统。</p> <p>4、dlsym的bug问题</p> <p><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1699239313255.webp" alt="1699239313255"></p> <p>你的错误消息表明在运行 <code>cat test_white_list.txt</code> 时出现了符号查找错误。这通常发生在共享库（<code>libhook.so</code>）中引用了一个未定义的符号。</p> <p>在这种情况下，可能发生以下情况：</p> <ol><li><p><strong>共享库问题</strong>：<code>libhook.so</code> 可能依赖于其他共享库，而这些库没有正确链接或者版本不匹配。你可以使用以下命令查看 <code>libhook.so</code> 的依赖关系：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>ldd libhook.so
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>确保所有依赖项都可以正确找到，并且版本匹配。</p></li> <li><p><strong>库加载顺序</strong>：在运行 <code>cat</code> 时，动态链接器加载共享库。可能 <code>libhook.so</code> 被加载，但它依赖的符号在加载时找不到。你可以尝试设置 <code>LD_PRELOAD</code> 环境变量来确保 <code>libhook.so</code> 在其他库之前加载：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>LD_PRELOAD=/path/to/libhook.so cat test_white_list.txt
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div></li> <li><p><strong>CMake 链接问题</strong>：检查你的 CMake 构建脚本是否正确配置了链接依赖项，特别是 <code>dlsym</code> 这个符号是否正确链接到 <code>libdl</code> 库。确保你的 <code>CMakeLists.txt</code> 文件中有类似以下的行：</p> <div class="language-cmake line-numbers-mode"><pre class="language-cmake"><code><span class="token keyword">target_link_libraries</span><span class="token punctuation">(</span>your_target_name dl<span class="token punctuation">)</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>这将确保 <code>libdl</code> 库正确链接到你的项目中。</p></li></ol> <p>如果以上方法仍无法解决问题，你可能需要进一步检查共享库的依赖关系和构建过程，以确保所有库正确链接，并且符号都能够正确解析。</p> <p><img src="https://cdn.jsdelivr.net/gh/xiaose-code/Pictures@main/img/1699239389830.webp" alt="1699239389830"></p> <p>根据你提供的 <code>libcjson.so.1</code> 的依赖信息，它似乎没有显式依赖于 <code>libdl</code> 库，因为 <code>libdl</code> 没有在依赖列表中。</p> <p>问题可能出在 <code>libhook.so</code> 中，它依赖于 <code>cjson</code> 并可能间接依赖于 <code>libdl</code>，但却未正确链接到 <code>libdl</code>。</p> <p>你可以尝试在 <code>libhook.so</code> 的构建过程中显式链接到 <code>libdl</code>，以确保 <code>dlsym</code> 等符号能够正确解析。在你的 CMakeLists.txt 文件中添加以下行：</p> <div class="language-cmake line-numbers-mode"><pre class="language-cmake"><code><span class="token keyword">target_link_libraries</span><span class="token punctuation">(</span><span class="token punctuation">${</span><span class="token variable">CMAKE_PROJECT_NAME</span><span class="token punctuation">}</span> <span class="token namespace">PRIVATE</span> cjson dl<span class="token punctuation">)</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>这将确保在构建 <code>libhook.so</code> 时，它会正确链接到 <code>libdl</code>。</p> <p>重新构建 <code>libhook.so</code> 后，再次运行你的测试命令 <code>cat test_white_list.txt</code>，看看是否问题得到解决。如果问题仍然存在，请确保 <code>libhook.so</code> 的链接设置和运行时环境都正确。</p></div></div> <!----> <div class="page-edit"><!----> <!----> <!----></div> <div class="page-nav-wapper"><div class="page-nav-centre-wrap"><a href="/pages/08dfe9/" class="page-nav-centre page-nav-centre-prev"><div class="tooltip">项目解读</div></a> <!----></div> <div class="page-nav"><p class="inner"><span class="prev">
        ←
        <a href="/pages/08dfe9/" class="prev">项目解读</a></span> <!----></p></div></div></div> <!----></main></div> <div class="footer"><!----> 
  Theme by
  <a href="https://github.com/xugaoyi/vuepress-theme-vdoing" target="_blank" title="本站主题">Vdoing</a> 
    | Copyright © 2023-2023
    <span>霜晨月</span></div> <div class="buttons"><div title="返回顶部" class="button blur go-to-top iconfont icon-fanhuidingbu" style="display:none;"></div> <div title="去评论" class="button blur go-to-comment iconfont icon-pinglun" style="display:none;"></div> <div title="主题模式" class="button blur theme-mode-but iconfont icon-zhuti"><ul class="select-box" style="display:none;"><li class="iconfont icon-zidong">
          跟随系统
        </li><li class="iconfont icon-rijianmoshi">
          浅色模式
        </li><li class="iconfont icon-yejianmoshi">
          深色模式
        </li><li class="iconfont icon-yuedu">
          阅读模式
        </li></ul></div></div> <!----> <!----> <!----></div><div class="global-ui"><canvas id="vuepress-canvas-cursor"></canvas></div></div>
    <script src="/assets/js/app.ef25b098.js" defer></script><script src="/assets/js/2.4615a819.js" defer></script><script src="/assets/js/86.b6a21db1.js" defer></script>
  </body>
</html>
